﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="EditStudentsScreen.aspx.cs" Inherits="METU_CMT.EditStudentsScreen" %>

<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager runat="server" ID="dfjkhslkjdf">
    </asp:ScriptManager>
    <asp:Table ID="Table1" runat="server" Width="100%" HorizontalAlign="Center" CssClass="chp-grid"
        Style="font-size: 15px; margin-top: 50px;">
        <asp:TableRow ID="TableRow1" runat="server">
            <asp:TableCell ID="TableCell4" runat="server" Width="50%">
                <asp:Table ID="Table2" runat="server" Width="100%" HorizontalAlign="Center">
                    <asp:TableRow ID="TableRow2" runat="server">
                        <asp:TableCell ID="TableCell1" runat="server" Width="150">Student Name</asp:TableCell>
                        <asp:TableCell ID="TableCell3" runat="server" HorizontalAlign="Left">
                            <asp:TextBox runat="server" ID="txtNewStudentName" CssClass="chp-text-field"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtNewStudentName"
                                Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE">* Name is required!</asp:RequiredFieldValidator>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow4" runat="server">
                        <asp:TableCell ID="TableCell5" runat="server" Width="150">Student Surname</asp:TableCell>
                        <asp:TableCell ID="TableCell6" runat="server" HorizontalAlign="Left">
                            <asp:TextBox runat="server" ID="txtNewStudentSurName" CssClass="chp-text-field"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtNewStudentSurName"
                                Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE">* Surname is required!</asp:RequiredFieldValidator>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow5" runat="server">
                        <asp:TableCell ID="TableCell7" runat="server" Width="150">Student UserName</asp:TableCell>
                        <asp:TableCell ID="TableCell8" runat="server" HorizontalAlign="Left">
                            <asp:TextBox runat="server" ID="txtNewStudentUserName" CssClass="chp-text-field"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtNewStudentUserName"
                                Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE">* User name is required!</asp:RequiredFieldValidator>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow6" runat="server">
                        <asp:TableCell ID="TableCell9" runat="server" Width="150">Student EMail</asp:TableCell>
                        <asp:TableCell ID="TableCell10" runat="server" HorizontalAlign="Left">
                            <asp:TextBox runat="server" ID="txtNewStudentEmail" CssClass="chp-text-field"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtNewStudentEmail"
                                Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE">* E-mail is required!</asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                ControlToValidate="txtNewStudentEmail" ErrorMessage="Invalid Email Format" ValidationGroup="MKE"></asp:RegularExpressionValidator>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow7" runat="server">
                        <asp:TableCell ID="TableCell11" runat="server" Width="150">Student ExpiryDate</asp:TableCell>
                        <asp:TableCell ID="TableCell12" runat="server" HorizontalAlign="Left">
                            <asp:TextBox runat="server" ID="txtNewStudentExpiryDate" CssClass="chp-text-field"></asp:TextBox>
                            <asp:MaskedEditExtender ID="MaskedEditExtender25" runat="server" TargetControlID="txtNewStudentExpiryDate"
                                Mask="99/99/9999" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus"
                                OnInvalidCssClass="MaskedEditError" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"
                                ErrorTooltipEnabled="True" />
                            <asp:MaskedEditValidator ID="MaskedasdasdEditValidator12" runat="server" ControlExtender="MaskedEditExtender25"
                                ControlToValidate="txtNewStudentExpiryDate" EmptyValueMessage="Date is required"
                                InvalidValueMessage="Date is invalid" IsValidEmpty="False" TooltipMessage="Input a Date"
                                ValidationGroup="MKE" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow ID="TableRow8" runat="server">
                        <asp:TableCell ID="TableCell14" runat="server" HorizontalAlign="Left" ColumnSpan="2">
                            <asp:Button runat="server" ID="btnAdd" OnClick="OnBtnAddClicked" Text="Add" ValidationGroup="MKE"
                                CssClass="chp-button-red" />
                            <br />
                            <br />
                        </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
            </asp:TableCell>
            <asp:TableCell ID="TableCell2" runat="server" Width="50%">
                <asp:GridView runat="server" ID="dtgStudentsHavingAccounts" AutoGenerateColumns="false"
                    CssClass="chp-grid" ShowHeaderWhenEmpty="true" OnRowCommand="OnRowDtgStudentsHavingAccountsRowCommand">
                    <Columns>
                        <asp:BoundField DataField="Name" HeaderText="Name" />
                        <asp:BoundField DataField="Surname" HeaderText="Surname" />
                        <asp:BoundField DataField="UserName" HeaderText="UserName" />
                        <asp:BoundField DataField="ExpiryDateString" HeaderText="Expiry Date" />
                        <asp:TemplateField HeaderText="Action">
                            <ItemTemplate>
                                <asp:LinkButton runat="server" ID="lnkBtnAddToCourse" CommandName="AddToCourse" Text="Add To Course"
                                    CommandArgument='<%# Bind("UserId") %>'></asp:LinkButton>
                                <asp:HiddenField ID="hfId" runat="server" Value='<%# Bind("UserId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow ID="TableRow3" runat="server">
            <asp:TableCell ID="TableCell13" runat="server" ColumnSpan="2">
                <asp:GridView ID="dtgStudents" runat="server" Width="100%" ShowHeaderWhenEmpty="true"
                    AutoGenerateColumns="false" OnRowCancelingEdit="OnDtgStudentsCancellingEdit"
                    OnRowEditing="OnDtgStudentsRowEditing" OnRowCommand="OnDtgStudentsRowCommand"
                    OnRowUpdating="OnDtgStudentsRowUpdating" ShowFooter="True" OnRowDeleting="OnDtgStudentsRowDeleting"
                    CssClass="chp-grid">
                    <Columns>
                        <asp:TemplateField HeaderText="Name">
                            <ItemTemplate>
                                <asp:Label ID="lblName" Text='<%# Bind("Name") %>' runat="server"></asp:Label>
                                <asp:HiddenField ID="hfId" Value='<%# Bind("UserId") %>' runat="server"></asp:HiddenField>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtNameEdit" Text='<%# Bind("Name") %>' runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtNameEdit"
                                    Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE1">* Name is required!</asp:RequiredFieldValidator>
                                <asp:HiddenField ID="hfId" Value='<%# Bind("UserId") %>' runat="server"></asp:HiddenField>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Surname">
                            <ItemTemplate>
                                <asp:Label ID="lblSurname" Text='<%# Bind("Surname") %>' runat="server"></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtSurnameEdit" Text='<%# Bind("Surname") %>' runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtSurnameEdit"
                                    Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE1">* Surname is required!</asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Username">
                            <ItemTemplate>
                                <asp:Label ID="lblUserName" Text='<%# Bind("UserName") %>' runat="server"></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtUserNameEdit" Text='<%# Bind("UserName") %>' runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtUserNameEdit"
                                    Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE1">* User name is required!</asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="E-Mail Address">
                            <ItemTemplate>
                                <asp:Label ID="lblEMail" Text='<%# Bind("EMail") %>' runat="server"></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtEMailEdit" Text='<%# Bind("EMail") %>' runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtEMailEdit"
                                    Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="MKE1">* E-mail is required!</asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                    ControlToValidate="txtEMailEdit" ErrorMessage="Invalid Email Format" ValidationGroup="MKE1"></asp:RegularExpressionValidator>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Expiry Date">
                            <ItemTemplate>
                                <asp:Label ID="lblExpiryDate" Text='<%# Bind("ExpiryDateString") %>' runat="server"></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtExpiryDateEdit" Text='<%# Bind("ExpiryDateString") %>' runat="server"></asp:TextBox>
                                <asp:MaskedEditExtender ID="MaskedEditExtender2sd5" runat="server" TargetControlID="txtExpiryDateEdit"
                                    Mask="99/99/9999" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus"
                                    OnInvalidCssClass="MaskedEditError" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"
                                    ErrorTooltipEnabled="True" />
                                <asp:MaskedEditValidator ID="MaskedasdasdEditValidator12312" runat="server" ControlExtender="MaskedEditExtender2sd5"
                                    ControlToValidate="txtExpiryDateEdit" EmptyValueMessage="Date is required" InvalidValueMessage="Date is invalid"
                                    IsValidEmpty="False" TooltipMessage="Input a Date" ValidationGroup="MKE1" />
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Action">
                            <ItemTemplate>
                                <asp:LinkButton runat="server" ID="lnkBtnDelete" Text="Delete" CommandName="Delete"></asp:LinkButton>
                                <asp:LinkButton runat="server" ID="lnkBtnEdit" Text="Edit" CommandName="Edit"></asp:LinkButton>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <p>
                                    <asp:LinkButton ID="lbtnUpdate" runat="server" CausesValidation="True" CommandName="Update"
                                        ValidationGroup="MKE1" Text="Save"></asp:LinkButton>
                                </p>
                                <p>
                                    <asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                                        Text="Cancel"></asp:LinkButton>
                                </p>
                            </EditItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </asp:TableCell>
        </asp:TableRow>
    </asp:Table>
</asp:Content>
